package cn.edu.upc.letao.controller;

import cn.edu.upc.letao.entity.PoolLabel;
<<<<<<< HEAD
import cn.edu.upc.letao.model.ReturnMessage;
=======
import cn.edu.upc.letao.redisRepository.LabelRepository;
>>>>>>> 656d1e0fc23ec798a8dba36f017a70cd2371a127
import cn.edu.upc.letao.service.PoolLabelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by 风飞扬 on 2017/6/2.
 */
@RestController
@RequestMapping("label")
public class PoolLabelController {
    @Autowired
    private PoolLabelService poolLabelService;

<<<<<<< HEAD
=======
    @Autowired
    private LabelRepository labelRepository;

>>>>>>> 656d1e0fc23ec798a8dba36f017a70cd2371a127
    //查询所有的池子标签
    @RequestMapping(value = "findAll")
    public Object findAll(){
        return poolLabelService.findAll();
    }

<<<<<<< HEAD
=======

    //下面的所有内容都是测试用  项目中不用

    //从redis中查询所有的池子标签  测试用的 项目中不用
    @RequestMapping(value = "findAllFromRedis")
    public Object findAllFromRedis(){
        return labelRepository.findAllLabels();
    }

    //根据池子id查询标签
    @RequestMapping(value = "findOne")
    public Object findOne(Integer id){
        return poolLabelService.getOne(id);
    }
    //删除
    @RequestMapping(value = "delete")
    public Object delete (Integer id) {
        return poolLabelService.delete(id);
    }
    //add
    @RequestMapping(value = "add")
    public Object add (PoolLabel label) {
        poolLabelService.add(label);
        return "添加成功";
    }

>>>>>>> 656d1e0fc23ec798a8dba36f017a70cd2371a127
}
